package ch.selise.exercise.pattern.notepad.command.impl;

import ch.selise.exercise.pattern.notepad.command.CommandExecutor;
import ch.selise.exercise.pattern.notepad.command.ICommand;
import ch.selise.exercise.pattern.notepad.command.IUndoableCommand;
import ch.selise.exercise.pattern.notepad.command.StackManipulator;
import ch.selise.exercise.pattern.notepad.exception.EmptyStackException;
import ch.selise.exercise.pattern.notepad.exception.ExecuteException;
import ch.selise.exercise.pattern.notepad.storage.AppStorageSingleton;

public class RedoCommand implements ICommand {

	//CommandExecutor ce;
	//IUndoableCommand command;
	StackManipulator stackManipulator;
	public RedoCommand(StackManipulator stackManipulator)
	{
		//this.ce = ce;
		//this.command = command;
		this.stackManipulator = stackManipulator;
	}
	
	@Override
	public void execute() throws ExecuteException {
		/*try {
			IUndoableCommand redo = AppStorageSingleton.getInstance().redoCommand();
			redo.redoCommand();
		} catch (EmptyStackException e) {
			throw new ExecuteException(e);
		}*/
		try {
			stackManipulator.redoCommand();
		} catch (EmptyStackException e) {
			throw new ExecuteException(e);
		}
		
	}

}
